﻿@model Site.Models.LoginDTO
@{
    ViewBag.Title = "Home";
    if (ViewBag.Message != null)
    {
        <script> alert("@ViewBag.Message");</script>
    }
}

@{

    <h2>Home</h2>
    if (Session["Username"] == null)
    {
        using (Html.BeginForm("Login", "Home"))
        {

            @Html.LabelFor(model => model.Username)
            @Html.TextBoxFor(model => model.Username)
            @Html.LabelFor(model => model.Password)
            @Html.PasswordFor(model => model.Password)
            <input type="submit" value="Log in" />
            
            
        }
        @Html.ActionLink("Click here to register", "Register");
    }
    else
    {    
        <p>
            Logged in as: @Session["Username"] <br/>
            @Html.ActionLink("Log out", "Logout")
        </p>
        <p>
            @Html.ActionLink("View active games", "Index", "ActiveGames") <br/>
            @Html.ActionLink("View open games", "Index", "OpenGames") <br/>
            @Html.ActionLink("View finished games", "Index", "FinishedGames")
        </p>
    }

}